package com.nhjf.admin.common.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

import com.nhjf.common.ClassPathTool;

/**
 * 仓库物流配置对象
 * @author huangjingying
 * @company 浙江汇购科技有限公司
 * 2011-12-14
 * com.nhjf.common.util.tools
 * @version 1.0
 *
 */
public class StockTool {
	Properties properties = new Properties();
	private static StockTool stockTool;
	
	private StockTool(){
		
		try {
			File file = new File(ClassPathTool.getInstance().getWebRootPath()+"/WEB-INF/classes/stock.properties");
			FileInputStream input = new FileInputStream(file);
			properties.load(input);
			input.close();
		} catch (FileNotFoundException e) {
			LogMessage.logwrite(this.getClass(), e.getMessage());
		} catch (IOException e) {
			LogMessage.logwrite(this.getClass(), e.getMessage());
		}
	}

	public static StockTool getInstance(){
		if(stockTool == null){
			stockTool = new StockTool();
		}
		return stockTool;
	}
	
	public String getValue(String key){
		return (String)properties.get(key);
	}

}
